
import axios from 'axios';

/**
 * 地址
 */
export class AddressService {
    // 分页查询列表
    static findAddresss (queryParams) {
        return axios({
            url: '/restaurant/sale/Address/findAddresss',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的地址
    static findAddress (addressId) {
        const query = {
            addressId
        }
        return axios({
            url: '/restaurant/sale/Address/findAddress',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的地址(包含外键名称)
    static findAddressForView (addressId) {
        const query = {
            addressId
        }
        return axios({
            url: '/restaurant/sale/Address/findAddressForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的地址(包含外键名称)
    static findAddressForEdit (addressId) {
        const query = {
            addressId
        }
        return axios({
            url: '/restaurant/sale/Address/findAddressForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的地址(只提取ID 和 Name)
    static findAddresssWithIdNameById (addressId) {
        const query = {
            addressId
        }
        return axios({
            url: '/restaurant/sale/Address/findAddresssWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询地址集合(只提取ID 和 Name)
    static findAddresssWithIdNameByName (addressName) {
        const query = {
            addressName
        }
        return axios({
            url: '/restaurant/sale/Address/findAddresssWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存地址
    static saveAddress (address) {
        const query = {}
        return axios({
            url: '/restaurant/sale/Address/saveAddress',
            method: 'POST',
            params: query,
            data: address
        });
    }

    //修改保存地址
    static updateAddress (address) {
        const query = {}
        return axios({
            url: '/restaurant/sale/Address/updateAddress',
            method: 'POST',
            params: query,
            data: address
        });
    }

    //根据ID查询指定的地址(只提取ID 和 Name)
    static deleteAddress (addressId) {
        const query = {
            addressId
        }
        return axios({
            url: '/restaurant/sale/Address/deleteAddress',
            method: 'POST',
            params: query,
        });
    }
}
